justfile: Accept args, add build-host shortcuts
authorColin Walters <walters@verbum.org>
Tue, 17 Jun 2025 22:11:46 +0000 (18:11 -0400)
committerColin Walters <walters@verbum.org>
Wed, 25 Jun 2025 17:40:19 +0000 (13:40 -0400)
Signed-off-by: Colin Walters <walters@verbum.org>
Dockerfile
Justfile

index 21cc2ba176371baa034eda9deaca4ca269312989..412f21a49014c08c7dc2ae85d8adf862b773c7d7 100644 (file)
@@ -39,10 +39,15 @@ RUN rpm -e --nodeps ostree{,-libs}
 COPY --from=build /out/ /
 COPY --from=src /src/tests-unit-container /tests
 
-# The default final container
-FROM $base
+# Override userspace
+FROM $base as rootfs
+# Remove the default binaries to ensure we're getting our overrides
 RUN rpm -e --nodeps ostree{,-libs}
 COPY --from=build /out/ /
+
+# The default final container, with also a regenerated
+# initramfs in case ostree-prepare-root changed.
+FROM rootfs
 # https://docs.fedoraproject.org/en-US/bootc/initramfs/#_regenerating_the_initrd
 # since we have ostree-prepare-root there
 RUN set -x; kver=$(cd /usr/lib/modules && echo *); dracut -vf /usr/lib/modules/$kver/initramfs.img $kver
index 8e6bf8d29bd2f7efa3fa039b77a7d437712793e4..7dee1287ab3eec5bafa37efc4a66fef5b983bd72 100644 (file)
--- a/Justfile
+++ b/Justfile
@@ -2,11 +2,15 @@
 osid := `. /usr/lib/os-release && echo $ID`
 
 # Build the container image from current sources
-build:
-    podman build --jobs=4 -t localhost/ostree .
+build *ARGS:
+    podman build --jobs=4 -t localhost/ostree {{ARGS}} .
 
-build-unittest:
-    podman build --jobs=4 --target build -t localhost/ostree-buildroot .
+build-unittest *ARGS:
+    podman build --jobs=4 --target build -t localhost/ostree-buildroot {{ARGS}} .
+
+# Do a build but don't regenerate the initramfs
+build-noinitramfs *ARGS:
+    podman build --jobs=4 --target rootfs -t localhost/ostree {{ARGS}} .
 
 # We need a filesystem that supports O_TMPFILE right now (i.e. not overlayfs)
 # or ostree hard crashes in the http code =/
@@ -35,3 +39,13 @@ unitcontainer: unitcontainer-build
     # need cap-add=all for mounting
     podman run --rm --net=none {{unitpriv}} {{unittest_args}} --cap-add=all --env=TEST_CONTAINER=1 localhost/ostree-bintest /tests/run.sh
     
+# Run a build on the host system
+build-host:
+    . ci/libbuild.sh && build
+
+# Run a build on the host system and "install" into target/inst
+# This directory tree can then be copied elsewhere
+build-host-inst: build-host
+    make -C target/c install DESTDIR=$(pwd)/target/inst
+    tar --sort=name --numeric-owner --owner=0 --group=0 -C target/inst -czf target/inst.tar.gz .
+